home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 January: Mac OS SDK / Dev.CD Jan 96 SDK / Dev.CD Jan 96 SDK1.toast / Development Kits (Disc 1) / AOCE / Development Tools / Sample Code / Messaging Service Access Module / Internet PMSAM / Template source / Internet Setup Template / InternetMailService.code.h < prev    next >
Encoding:
Text File  |  1993-10-29  |  6.0 KB  |  175 lines  |  [TEXT/MPS ]

  1. //#define    kDEBUG
  2.  
  3. #ifdef kDEBUG
  4. #define    TraceExecution(x) DebugStr(x)
  5. #else
  6. #define    TraceExecution(x)
  7. #endif
  8.  
  9. // constants --------------------------------------------------------------
  10.  
  11. #define    kAttrBufferSize        8192L
  12. #define    kRecordBufferSize    8192L
  13. #define    kIdentity            0
  14. #define    kMSAMVersion        1L
  15. #define    kTimeout            (30*60)
  16. #define    kStdSlotInfoVersion    1
  17.  
  18. #define    kInternalError        -1
  19. #define    kNoRecords            -2
  20.  
  21. // resource ids
  22.  
  23. #define    kOldPasswordItem    3
  24. #define    kNewPasswordItem    4
  25. #define    kPasswordDialog        128
  26. #define    kNoPrevPassDialog    129
  27. #define    kIncorrectPWAlert    130
  28.  
  29. // attribute type names
  30.  
  31. #define    kSetupAttr            ((AttributeTypePtr)"\0\0\0\23AOCE Internet Setup")
  32. #define    kVersionAttribute    (OCEGetIndAttributeType(kVersionAttrTypeNum))
  33.  
  34. #define    kOCESetupRecName    ((RStringPtr)"\0\0\0\21\0OCE Setup Record")
  35.  
  36. #define    kMSAMRecordName        ((RStringPtr)"\0\0\0\15Internet MSAM")
  37.  
  38. #define kDirectoryName        ((DirectoryName *)"\0\0\0\22Internet Directory")
  39. #define    kDirNameLength        22
  40. #define    kDirectoryComment    ((RStringPtr)"\0\0\0\7comment")
  41. #define    kCommentLength        11
  42. #define kDirectoryType        ((RStringPtr)"\0\0\0\22aoce DirectoryInet")
  43. #define    kDirTypeLength        (18+4)
  44.  
  45. #define    kMailServiceName    ((RStringPtr)"\0\0\0\20Internet Service")
  46. #define    kMailServiceType    ((RStringPtr)"\0\0\0\25aoce Mail ServiceInet")
  47.  
  48. // other gateway specific defines
  49.  
  50. #define    kDirectoryOSType    'Inet'
  51.  
  52. // states of template
  53.  
  54. enum {
  55.     kIdle,
  56.     kDoingCreate,
  57.     kDoingModify
  58. };
  59.  
  60. // typedefs ---------------------------------------------------------------
  61.  
  62. // gateway-specific slot information
  63.  
  64. typedef struct SpecificSlotInfo {
  65.     char popServer[64];
  66.     char smtpServer[64];
  67. } SpecificSlotInfo;
  68.  
  69.  
  70. // external directory identity information
  71.  
  72. typedef struct DirIdentity {
  73.     char userName[64];
  74.     char password[64];
  75.     char oldPassword[64];
  76. } DirIdentity;
  77.  
  78. // all configuration information read from or written to the info page
  79.  
  80. typedef struct ConfigInformation {
  81.     MailStandardSlotInfoAttribute    stdInfo;
  82.     SpecificSlotInfo                specInfo;
  83.     DirIdentity                        dirIdentity;
  84. } ConfigInformation;
  85.  
  86. // global data block used across calls to external det code
  87.  
  88. typedef struct GlobalData {
  89.     ConfigInformation config;
  90.     short oceSetupDSRef;
  91.     CreationID directoryCID;
  92.     CreationID mailCID;
  93.     Boolean hasBeenCreated;
  94.     Boolean    fakeDirectory;
  95. } GlobalData;
  96.  
  97. // convenience structure for password dialog
  98.  
  99. typedef struct PasswordDialogData {
  100.     char *oldPassword;
  101.     char *password;
  102. } PasswordDialogData;
  103.  
  104.  
  105. // passed in the client data to lookup parse so we have a place to copy data
  106.  
  107. typedef struct AttributeCopyInfo {
  108.     Ptr buffer;
  109.     Size bufferSize;
  110.     CreationID *creationID;
  111.     Boolean gotOne;
  112. } AttributeCopyInfo,*AttributeCopyInfoPtr;
  113.  
  114. // passed into record parse
  115.  
  116. typedef struct RecordCopyInfo {
  117.     CreationID *creationID;
  118.     Boolean gotOne;
  119.     RStringPtr recordName;
  120. } RecordCopyInfo;
  121.  
  122.  
  123. // prototypes -------------------------------------------------------------
  124.  
  125. pascal OSErr InternetMailServiceCode(DETCallBlockPtr callBlockPtr);
  126.  
  127. OSErr InitTemplate(DETCallBlockPtr callBlockPtr);
  128. OSErr InitInstance(DETCallBlockPtr callBlockPtr);
  129. OSErr ExitInstance(DETCallBlockPtr callBlockPtr);
  130. OSErr ValidateSave(DETCallBlockPtr callBlockPtr);
  131. OSErr PropertyItemHit(DETCallBlockPtr callBlockPtr);
  132. OSErr UpdateDisplayNames(DETCallBlockPtr callBlockPtr,GlobalData *globalData);
  133.  
  134. OSErr CheckFileIDs(DETCallBlockPtr callBlockPtr);
  135. OSErr GetMailSlotInfo(short dsRef,const CreationID *mailCID,ConfigInformation *config,Boolean *hasBeenCreated);
  136. OSErr GetDirectoryInfo(short dsRef,const CreationID *directoryCID,ConfigInformation *config,Boolean *directoryIsFake);
  137.  
  138. OSErr SetInfoPageInformation(DETCallBlockPtr callBlockPtr,ConfigInformation *config);
  139. OSErr GetInfoPageInformation(DETCallBlockPtr callBlockPtr,ConfigInformation *config);
  140. Boolean HasBeenChanged(DETCallBlockPtr callBlockPtr,ConfigInformation *config);
  141.  
  142. OSErr GetStringProperty(DETCallBlockPtr callBlockPtr, short property, RString *str);
  143. OSErr SetStringProperty(DETCallBlockPtr callBlockPtr, RString *string, short property);
  144. OSErr SetNumProperty(DETCallBlockPtr callBlockPtr, short property, long value);
  145. OSErr GetNumProperty(DETCallBlockPtr callBlockPtr, short property, long *value);
  146. OSErr DirtyProperty(DETCallBlockPtr callBlockPtr, short property);
  147. OSErr GetFileID(DETCallBlockPtr callBlockPtr,long *fileID);
  148. OSErr DoBusy(DETCallBlockPtr callBlockPtr);
  149. OSErr RequestSync(DETCallBlockPtr callBlockPtr);
  150.  
  151. OSErr ModifyOurSlot(DETCallBlockPtr callBlockPtr,GlobalData *globalData);
  152. OSErr CreateOurSlot(DETCallBlockPtr callBlockPtr,GlobalData *globalData);
  153.  
  154. OSErr ChangeSingleAttribute(const CreationID *cid,short dsRef,AttributeType *attribType,void *data,unsigned long dataLength,AttributeTag tag);
  155. OSErr DeleteAttributeType(const CreationID *cid,short dsRef,AttributeType *attribType);
  156. OSErr GetSingleValueAttribute(const CreationID *cid,short dsRef,AttributeType *attribType,void *attrBuffer,Size attrBufferSize,CreationID *retCID);
  157. pascal Boolean RecordIDCallback(long clientData, const RecordID *recordID);
  158. pascal Boolean SingleAttrValueCallback(long clientData, const Attribute *attribute);
  159. OSErr GetSingleRecord(short dsRef,RStringPtr recordType,RStringPtr recordName,CreationID *returnedCID);
  160. pascal Boolean GatewayDirEnumCallback(long clientData, const DirEnumSpec *enumSpec);
  161. OSErr AddAttribute(const CreationID *cid,short dsRef,AttributeType *attribType,void *data,unsigned long dataLength,AttributeTag tag);
  162. OSErr SetRecNameAndType(const CreationID *cid,short dsRef,RStringPtr newName,RStringPtr newType);
  163. OSErr AddRecord(short dsRefNum,RStringPtr recordName,RStringPtr recordType,CreationID *newCID);
  164. OSErr AddDirectoryIdentity(const CreationID *cid,char *userName,char *password);
  165. OSErr ChangeDirectoryIdentity(const CreationID *cid,char *userName,char *password,char *oldPassword);
  166. void MakePersonalRecordID(RecordID *recordID,const CreationID *creationID);
  167. void GetCreationIDFromDSSpec(const PackedDSSpec *dsSpec,CreationID *cid);
  168.  
  169. OSErr SetUserPassword(char *passwordStorage);
  170. void ChangePassword(char *pwStorage);
  171. Boolean GetPasswordDialog(char *oldPassword,char *password,Boolean hasPassword);
  172. pascal Boolean PasswordFilter(DialogPtr theDialog,EventRecord *theEvent,short *itemHit);
  173.  
  174. void DoError(OSErr err);
  175.